﻿<%@ Page Title="" Language="C#" MasterPageFile="~/backend/MasterPage_backend.master" AutoEventWireup="true" CodeFile="Department.aspx.cs" Inherits="Department" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <!-- header-starts -->
			<div class="header-section">
				</div>
				<div class="header_bg">					
							<div class="header">
								<div class="head-t">
									<div class="logo">
										<a href="index.html"><img src="images/logo.png" class="img-responsive" alt=""> </a>
									</div>
										<!-- start header_right -->
									<div class="header_right">
										<div class="rgt-bottom">
										<div class="cart box_1">
											<a href="#">
												<h3> <span class="simpleCart_total">部门管理系统 DepartmentManagement</span></h3>
											</a>	
                                            <p>&nbsp;</p>
											<div class="clearfix"> </div>
										</div>
										<div class="clearfix"> </div>
									</div>
									<div class="search">
										<form>
											<input type="text" value="" placeholder="search...">
											<input type="submit" value="">
										</form>
									</div>
									<div class="clearfix"> </div>
								</div>
								<div class="clearfix"> </div>
							</div>
						</div>
					
				</div>
					<!-- //header-ends -->
    <div class="content">
        <div class="fo-top-di">
        <%--上部信息--%>
	        <div class="foot-top">
              <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
                    DataKeyNames="DpNo" DataSourceID="DepartmentDS" 
        DefaultMode="Insert" Height="114px" 
        Width="100%"  HorizontalAlign="Center" 
                    onpageindexchanging="DetailsView1_PageIndexChanging">
        <Fields>
            <asp:BoundField DataField="DpNo" HeaderText="部门编号：" 
                SortExpression="DpNo" >
            <HeaderStyle Width="150px" />
            <ItemStyle HorizontalAlign="Left" />
            </asp:BoundField>
            <asp:BoundField DataField="DpName" HeaderText="部门名称：" SortExpression="DpName" >
            <FooterStyle BackColor="#FFFFCC" ForeColor="Black" />
            <HeaderStyle BackColor="#F2F3F4" ForeColor="Black" HorizontalAlign="Center" />
            <ItemStyle BackColor="#F2F3F4" HorizontalAlign="Left" />
            </asp:BoundField>
            <asp:BoundField DataField="ManageNo" HeaderText="部门经理编号：" 
                SortExpression="ManageNo" >
            <ItemStyle HorizontalAlign="Left" />
            </asp:BoundField>
            <asp:CommandField ShowInsertButton="True" CancelText="" InsertText="新增" >
           
            <HeaderStyle BackColor="#FFFFCC" Font-Bold="True" ForeColor="#990000" 
                HorizontalAlign="Right" />
            <ItemStyle BackColor="#F2F3F4" Font-Bold="True" ForeColor="#990000" 
                HorizontalAlign="Center" />
            </asp:CommandField>
           
        </Fields>
    </asp:DetailsView>

			    <div class="clearfix"> </div>	            		
		    </div>
       <%--下部信息--%>
            <div class="footer">
               <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        CellPadding="4" DataKeyNames="DpNo" DataSourceID="DepartmentDS" 
        ForeColor="#333333" GridLines="None" Width="100%" 
        style="text-align: center">
        <AlternatingRowStyle BackColor="White" />
        <Columns>
            <asp:BoundField DataField="DpNo" HeaderText="部门编号" ReadOnly="True" 
                SortExpression="DpNo" >
            <HeaderStyle BackColor="Black" />
            </asp:BoundField>
            <asp:BoundField DataField="DpName" HeaderText="部门名" SortExpression="DpName" >
            <HeaderStyle BackColor="Black" />
            </asp:BoundField>
            <asp:BoundField DataField="ManageNo" HeaderText="部门经理" 
                SortExpression="ManageNo" >
            <HeaderStyle BackColor="Black" />
            </asp:BoundField>
            <asp:TemplateField ShowHeader="False" HeaderText="操作">
                <EditItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" 
                        CommandName="Update" Text="更新"></asp:LinkButton>
                    &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                        CommandName="Cancel" Text="取消"></asp:LinkButton>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" 
                        CommandName="Edit" Text="更改信息"></asp:LinkButton>
                    &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                        CommandName="Delete" onclientclick="return confirm(&quot;确定要删除？&quot;)" 
                        Text="删除"></asp:LinkButton>
                </ItemTemplate>
                <HeaderStyle BackColor="Black" />
            </asp:TemplateField>
        </Columns>
        <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
        <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
        <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
        <SortedAscendingCellStyle BackColor="#FDF5AC" />
        <SortedAscendingHeaderStyle BackColor="#4D0000" />
        <SortedDescendingCellStyle BackColor="#FCF6C0" />
        <SortedDescendingHeaderStyle BackColor="#820000" />
    </asp:GridView>
   <asp:SqlDataSource ID="DepartmentDS" runat="server" 
        ConnectionString="<%$ ConnectionStrings:HotelManagementConnectionString %>" 
        DeleteCommand="DELETE FROM Department WHERE (DpNO=@DpNo)" 
        InsertCommand="INSERT INTO Department(DpNo,DpName,ManageNo)VALUES(@DpNo,@DpName,@ManageNo)" 
        SelectCommand="SELECT * FROM [Department]" 
        
        UpdateCommand="UPDATE Department SET DpName = @DpName, ManageNo = @ManageNo WHERE (DpNo = @DpNo)">
        <DeleteParameters>
            <asp:Parameter Name="DpNo" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="DpNo" />
            <asp:Parameter Name="DpName" />
            <asp:Parameter Name="ManageNo" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="DpName" />
            <asp:Parameter Name="ManageNo" />
            <asp:Parameter Name="DpNo" />
        </UpdateParameters>
    </asp:SqlDataSource>

	            <div class="clearfix"> </div>
		             <p>@ 2017 HotelManagement. All Rights Reserved | Design by <a href="#">us</a></p>
            </div>
        </div>
    </div>
</asp:Content>

